package cn.gok.dao;

import cn.gok.bo.StudentInfoBo;
import cn.gok.entity.TDormitory;
import cn.gok.entity.TDormitoryPositon;
import cn.gok.entity.TStudent;
import cn.gok.entity.TStudentDormitory;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ManagerDao {
    //查看学生列表
    List<StudentInfoBo> queryStudent(@Param("realName") String realName,@Param("gender") String gender,@Param("schoolName") String schoolName
   , @Param("startTime") String startTime,@Param("endTime") String  denTime);
    //添加学生
    int addStudent(@Param("realName") String realName,@Param("stuName")String stuName,
                   @Param("password")String password,@Param("gender")String gender,@Param("age")int age,
                   @Param("schoolName")String schoolName,@Param("phoneNum")String phoneNum);
    //新增宿舍
    int addDormitory(@Param("position")String position,@Param("apartmentName")String apartmentName,@Param("floor")String floor,@Param("doorNum")String doorNum,
                     @Param("max")String max,@Param("type") String type,@Param("state")String state,@Param("managerId")int managerId);

    //查询地址
    List<String>queryPosition();

    //查询单元号
    List<String >queryApartmentName();

    //批量插入学生信息
    int addStudents(List<TStudent> student);

    //修改宿舍信息
    int updateDormitory(@Param("doorNum")String doorNum,@Param("type")String type,@Param("max")String max,@Param("apartmentName")String
                        apartmentName,@Param("position")String position,@Param("oldDoorNum")String oldDoorNum);

    //通过位置确定有哪些层
    List<String>queryFloor(@Param("positon")String position,@Param("apartmentName")String apartmentName);

    //宿舍列表查看
    List<TDormitory>queryDormitory(@Param("apartmentName")String apartmentName, @Param("floor")String floor, @Param("type")String type, @Param("state")String state);

    //通过楼房id和学生性别去查有哪些宿舍
    List<TDormitory> queryAllDoorNumByDormPosId(@Param("dorm_pos_id") String  id,@Param("state") int state);

    //通过寝室门牌号去查询该寝室信息
    TDormitory queryDormitoryByDoor(@Param("doorNum") int doorNum);

    //通过寝室门牌号去减少该寝室的剩余床位数,并将宿舍更改为学生性别对应的状态
    int reduceSurplusNumByDoor(@Param("doorNum") int doorNum,@Param("state") int state);

    //通过寝室门牌号去查询该寝室的剩余的剩余人数
    int querySurplusNumByDoor(@Param("doorNum") int doorNum);

    //学生入住
    int studentCheckIn(@Param("stu_id") int stuId,@Param("dorm_id") int dormId);

    //通过学生id查询学生入住信息
    TStudentDormitory queryStuDormitoryByStuId(@Param("id") int id);

    //判断学号是否存在
    TStudent queryStudentById(@Param("stuId")String stuId);
    //查询所有的房屋位置信息
    List<TDormitoryPositon> queryAllDormitoryPosition();
    //退寝
    int out(@Param("stuId")String stuId);
    //退寝后，剩余床位加1
    int addSurplus(@Param("stuId")String stuId);
    //判断学生是否入住
    TStudent queryStudentLive(@Param("stuId")String stuId);
    //信息统计
    List<TDormitory> queryAll();
}
